<!-- 章节目录 -->
{if in_array($goods.paid_content_type, ['multi_chapter', 'chapter_groups', 'multi_file'])}
<div id="chapters-tab" class="tab-content p-6 hidden">
    {if $goods.paid_content_type == 'multi_chapter'}
    <!-- 多章节 -->
    {if $goods.paid_content.chapters && count($goods.paid_content.chapters) > 0}
    <div>
        {volist name="goods.paid_content.chapters" id="chapter"}
        {if $chapter.has_auth}
        <a href="{:_url_('goods.chapter', ['id' => $chapter.id])}" class="block last:border-b-0 mb-1 bg-gray-100 hover:bg-gray-50 transition-all">
        {else}
        <div class="last:border-b-0 mb-1 bg-gray-100 opacity-60">
        {/if}
            <div class="flex items-center justify-between py-3 px-2">
                <div class="flex-1">
                    <h4 class="font-medium text-gray-800 {if !$chapter.has_auth}text-gray-500{/if} truncate">
                        {$chapter.title}
                    </h4>
                    <div class="flex items-center mt-1 text-xs text-gray-500 space-x-2">
                        <span class="flex items-center space-x-1 transition-colors duration-200 hover:text-gray-700">
                        {if $chapter.resource_type == 'cloud'}
                        <i class="fas fa-cloud text-blue-500"></i> <span>云盘</span>
                        {elseif $chapter.resource_type == 'text'}
                        <i class="fas fa-file-alt text-green-500"></i> <span>图文</span>
                        {elseif $chapter.resource_type == 'video'}
                        <i class="fas fa-video text-red-500"></i> <span>视频</span>
                        <span class="flex items-center space-x-1 ml-2 text-gray-400">
                            <i class="fas fa-clock"></i>
                            <span>{:format_seconds($chapter.video_duration)}</span>
                        </span>
                        {elseif $chapter.resource_type == 'audio'}
                        <i class="fas fa-music text-purple-500"></i> <span>音频</span>
                        <span class="flex items-center space-x-1 ml-2 text-gray-400">
                            <i class="fas fa-clock"></i>
                            <span>{:format_seconds($chapter.audio_duration)}</span>
                        </span>
                        {elseif $chapter.resource_type == 'longtext'}
                        <i class="fas fa-file-alt text-orange-500"></i> <span>长文本</span>
                        {else}
                        <span>未知</span>
                        {/if}
                        </span>
                        {if isset($chapter.duration) && $chapter.duration}
                        <span class="text-gray-400">{$chapter.duration}</span>
                        {/if}
                    </div>
                </div>
                <div class="flex items-center">
                    {if $chapter.is_free}
                    <span class="px-2 py-1 bg-green-50 text-green-600 text-xs font-medium rounded-sm">
                        免费
                    </span>
                    {elseif !$chapter.has_auth}
                    <span class="text-gray-400 text-base">
                        <i class="fas fa-lock"></i>
                    </span>
                    {/if}
                </div>
            </div>
        {if $chapter.has_auth}
        </a>
        {else}
        </div>
        {/if}
        {/volist}
    </div>
    {else}
    <div class="text-center py-8 text-gray-500">
        <i class="fas fa-list text-3xl mb-2"></i>
        <p>暂无章节内容</p>
    </div>
    {/if}
    {elseif $goods.paid_content_type == 'chapter_groups'}
    <!-- 分组多章节文本 -->
    {if $goods.paid_content.groups && count($goods.paid_content.groups) > 0}
    <div class="space-y-6">
        {volist name="goods.paid_content.groups" id="group"}
        <div class=" rounded-md overflow-hidden">
            <!-- 分组标题 -->
            <div class="bg-gray-200 px-3 py-2 ">
                <h3 class="font-semibold text-gray-800">{$group.title}</h3>
            </div>

            <!-- 分组章节 -->
            <div class="">
                {if $group.chapters && count($group.chapters) > 0}
                <div>
                    {volist name="group.chapters" id="chapter"}
                    {if $chapter.has_auth}
                    <a href="{:_url_('goods.chapter', ['id' => $chapter.id])}" class="block last:border-b-0 mb-1 bg-gray-100 hover:bg-gray-50 transition-all">
                    {else}
                    <div class="last:border-b-0 mb-1 bg-gray-100 opacity-60">
                    {/if}
                        <div class="flex items-center justify-between py-3 px-2">
                        <div class="flex-1">
                                <h4 class="font-medium text-gray-800 {if !$chapter.has_auth}text-gray-500{/if} truncate">
                                {$chapter.title}
                            </h4>
                                <div class="flex items-center mt-1 text-xs text-gray-500 space-x-2">
                                    <span class="flex items-center space-x-1 transition-colors duration-200 hover:text-gray-700">
                                {if $chapter.resource_type == 'cloud'}
                                    <i class="fas fa-cloud text-blue-500"></i> <span>云盘</span>
                                {elseif $chapter.resource_type == 'text'}
                                    <i class="fas fa-file-alt text-green-500"></i> <span>图文</span>
                                {elseif $chapter.resource_type == 'video'}
                                    <i class="fas fa-video text-red-500"></i> <span>视频</span>
                                    <span class="flex items-center space-x-1 ml-2 text-gray-400">
                                        <i class="fas fa-clock"></i>
                                        <span>{:format_seconds($chapter.video_duration)}</span>
                                    </span>
                                {elseif $chapter.resource_type == 'audio'}
                                    <i class="fas fa-music text-purple-500"></i> <span>音频</span>
                                    <span class="flex items-center space-x-1 ml-2 text-gray-400">
                                        <i class="fas fa-clock"></i>
                                        <span>{:format_seconds($chapter.audio_duration)}</span>
                                    </span>
                                {elseif $chapter.resource_type == 'longtext'}
                                    <i class="fas fa-file-alt text-orange-500"></i> <span>长文本</span>
                                {else}
                                    <span>未知</span>
                                    {/if}
                                    </span>
                                    {if isset($chapter.duration) && $chapter.duration}
                                    <span class="text-gray-400">{$chapter.duration}</span>
                                {/if}
                                </div>
                        </div>
                            <div class="flex items-center">
                                {if $chapter.is_free}
                                <span class="px-2 py-1 bg-green-50 text-green-600 text-xs font-medium rounded-sm">
                                免费
                            </span>
                                {elseif !$chapter.has_auth}
                                <span class="text-gray-400 text-base">
                                <i class="fas fa-lock"></i>
                            </span>
                            {/if}
                        </div>
                    </div>
                    {if $chapter.has_auth}
                    </a>
                    {else}
                    </div>
                    {/if}
                    {/volist}
                </div>
                {else}
                <div class="text-center py-4 text-gray-500">
                    <p class="text-sm">该分组暂无章节</p>
                </div>
                {/if}
            </div>
        </div>
        {/volist}
    </div>
    {else}
    <div class="text-center py-8 text-gray-500">
        <i class="fas fa-list text-3xl mb-2"></i>
        <p>暂无分组内容</p>
    </div>
    {/if}
    {elseif $goods.paid_content_type == 'multi_file'}
    <!-- 多文件下载 -->
    <div class="mb-4">
        <h3 class="text-lg font-semibold text-gray-800 mb-3">文件列表</h3>
    </div>
    {if $goods.paid_content.files && count($goods.paid_content.files) > 0}
    <div>
        {volist name="goods.paid_content.files" id="file"}
        <div class="block last:border-b-0 mb-1 bg-gray-100 hover:bg-gray-50 transition-all">
            <div class="flex items-center justify-between py-3 px-2">
                <div class="flex-1">
                    <h4 class="font-medium text-gray-800 truncate">
                        {$file.title|default='文件'}
                    </h4>
                    <div class="flex items-center mt-1 text-xs text-gray-500 space-x-2">
                        <span class="flex items-center space-x-1 transition-colors duration-200 hover:text-gray-700">
                            {if strstr($file.file_url, '.pdf')}
                            <i class="fas fa-file-pdf text-red-500"></i> <span>PDF文档</span>
                            {elseif strstr($file.file_url, '.doc') || strstr($file.file_url, '.docx')}
                            <i class="fas fa-file-word text-blue-500"></i> <span>Word文档</span>
                            {elseif strstr($file.file_url, '.xls') || strstr($file.file_url, '.xlsx')}
                            <i class="fas fa-file-excel text-green-500"></i> <span>Excel表格</span>
                            {elseif strstr($file.file_url, '.ppt') || strstr($file.file_url, '.pptx')}
                            <i class="fas fa-file-powerpoint text-orange-500"></i> <span>PPT演示文稿</span>
                            {elseif strstr($file.file_url, '.zip') || strstr($file.file_url, '.rar')}
                            <i class="fas fa-file-archive text-yellow-500"></i> <span>压缩文件</span>
                            {elseif strstr($file.file_url, '.mp3') || strstr($file.file_url, '.wav')}
                            <i class="fas fa-file-audio text-purple-500"></i> <span>音频文件</span>
                            {elseif strstr($file.file_url, '.mp4') || strstr($file.file_url, '.mov')}
                            <i class="fas fa-file-video text-pink-500"></i> <span>视频文件</span>
                            {elseif strstr($file.file_url, '.jpg') || strstr($file.file_url, '.png') || strstr($file.file_url, '.gif')}
                            <i class="fas fa-file-image text-teal-500"></i> <span>图片文件</span>
                            {else}
                            <i class="fas fa-file text-gray-500"></i> <span>其他文件</span>
                            {/if}
                        </span>
                        {if $file.file_size}
                        <span class="text-gray-400">大小: {$file.file_size}</span>
                        {/if}
                        {if $file.description}
                        <span class="text-gray-400 truncate max-w-[150px]">{$file.description}</span>
                        {/if}
                    </div>
                </div>
                <div class="flex items-center">
                    {if $goods.has_paid || $goods.is_free}
                    <a href="{$file.file_url}" download class="px-3 py-1.5 bg-blue-500 text-white text-xs rounded hover:bg-blue-600 transition-colors">
                        <i class="fas fa-download mr-1"></i>下载
                    </a>
                    {else}
                    <span class="text-gray-400 text-base">
                        <i class="fas fa-lock"></i>
                    </span>
                    {/if}
                </div>
            </div>
        </div>
        {/volist}
    </div>
    {else}
    <div class="text-center py-8 text-gray-500">
        <i class="fas fa-file text-3xl mb-2"></i>
        <p>暂无文件内容</p>
    </div>
    {/if}
    {/if}
</div>
{/if}